package com.example.exercise.util;

import com.example.exercise.model.Book;
import com.example.exercise.model.BookType;

import java.util.ArrayList;
import java.util.List;

public class BookUtil {
    // 获得全部商品
    public static List<Book> getAll(){
        List<Book>  AllLIst=new ArrayList<>();
        AllLIst.add(redBook());
        AllLIst.add(threeBodyProblem());
        AllLIst.add(journeyToTheWest());
        AllLIst.add(waterMargin());
        AllLIst.add(dreamOfTheRedChamber());
        return AllLIst;
    }


    // 静态方法，创建不同的书籍
    public static Book redBook() {
        return new Book("1", "红楼梦", 2003, BookType.FICTION, "3249384123129");
    }

    public static Book threeBodyProblem() {
        return new Book("2", "三体", 2008, BookType.SCIENCE, "9787229066304");
    }

    public static Book journeyToTheWest() {
        return new Book("3", "西游记", 1592, BookType.FICTION, "9787535435032");
    }

    public static Book waterMargin() {
        return new Book("4", "水浒传", 1589, BookType.FICTION, "9787535437259");
    }

    public static Book dreamOfTheRedChamber() {
        return new Book("5", "三国演义", 1522, BookType.FICTION, "9787540472107");
    }
}
